package com.kede.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 
 * @TableName t_package_order
 */
@TableName(value ="t_package_order")
@Data
public class PackageOrderDomain implements Serializable {
    /**
     * 
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 预约上门开始时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    @TableField(value = "reserve_start_time")
    private LocalDateTime reserveStartTime;

    /**
     * 预约上门结束时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    @TableField(value = "reserve_end_time")
    private LocalDateTime reserveEndTime;

    /**
     * 订单编号
     */
    @TableField(value = "no")
    private String no;

    /**
     * 1 待确认 2已签收 3已拒签
     */
    @TableField(value = "status")
    private Integer status;

    /**
     * 
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(value = "create_time")
    private LocalDateTime createTime;

    /**
     * 来源认证id
     */
    @TableField(value = "src_cer_id")
    private Integer srcCerId;

    /**
     * 目标认证id
     */
    @TableField(value = "dest_cer_id")
    private Integer destCerId;

    /**
     *  1 门店 2 区代 3市代
     */
    @TableField(value = "src_cer_type")
    private Integer srcCerType;

    /**
     * 包裹id 多个用 , 分割
     */
    @TableField(value = "package_ids")
    private String packageIds;

    /**
     * 目标认证信息
     */
    @TableField(exist = false)
    private ZhiUserCertifiedDomain destInfo;

    /**
     * 来源认证信息
     */
    @TableField(exist = false)
    private ZhiUserCertifiedDomain srcInfo;

    @TableField(exist = false)
    private List<PackageDomain> detail;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        PackageOrderDomain other = (PackageOrderDomain) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getReserveStartTime() == null ? other.getReserveStartTime() == null : this.getReserveStartTime().equals(other.getReserveStartTime()))
            && (this.getReserveEndTime() == null ? other.getReserveEndTime() == null : this.getReserveEndTime().equals(other.getReserveEndTime()))
            && (this.getNo() == null ? other.getNo() == null : this.getNo().equals(other.getNo()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getSrcCerId() == null ? other.getSrcCerId() == null : this.getSrcCerId().equals(other.getSrcCerId()))
            && (this.getDestCerId() == null ? other.getDestCerId() == null : this.getDestCerId().equals(other.getDestCerId()))
            && (this.getSrcCerType() == null ? other.getSrcCerType() == null : this.getSrcCerType().equals(other.getSrcCerType()))
            && (this.getPackageIds() == null ? other.getPackageIds() == null : this.getPackageIds().equals(other.getPackageIds()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getReserveStartTime() == null) ? 0 : getReserveStartTime().hashCode());
        result = prime * result + ((getReserveEndTime() == null) ? 0 : getReserveEndTime().hashCode());
        result = prime * result + ((getNo() == null) ? 0 : getNo().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getSrcCerId() == null) ? 0 : getSrcCerId().hashCode());
        result = prime * result + ((getDestCerId() == null) ? 0 : getDestCerId().hashCode());
        result = prime * result + ((getSrcCerType() == null) ? 0 : getSrcCerType().hashCode());
        result = prime * result + ((getPackageIds() == null) ? 0 : getPackageIds().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", reserveStartTime=").append(reserveStartTime);
        sb.append(", reserveEndTime=").append(reserveEndTime);
        sb.append(", no=").append(no);
        sb.append(", status=").append(status);
        sb.append(", createTime=").append(createTime);
        sb.append(", srcCerId=").append(srcCerId);
        sb.append(", destCerId=").append(destCerId);
        sb.append(", srcCerType=").append(srcCerType);
        sb.append(", packageIds=").append(packageIds);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}